@extends('admin.public')

@section('content')
    <div class="col-md-12">
        @if( !empty($banners) )
            <section class="panel panel-default">
                <header class="panel-heading bg-light">
                    <ul class="nav nav-tabs nav-justified">
                        <?php $i = 0; ?>
                        @foreach( $banners as $label=> $value)
                            <li {{ $i==0?'class=active':'' }}>
                                <a href="#{{ $label }}" data-toggle="tab">{{ $value['name'] }}</a>
                            </li>
                            <?php $i++; ?>
                        @endforeach
                    </ul>
                </header>
                <div class="panel-body">
                    <div class="tab-content">
                        <?php $j = 0; ?>
                        @foreach($banners as $label => $value)
                            <div class="tab-pane {{ $j==0?'active':'' }}" id="{{ $label }}">
                                <div class="col-md-12">
                                    <section class="panel panel-default">
                                        <header class="panel-heading">
                                            <a href="{{ route('admin.banner.banner_add',$label) }}"
                                               class="btn btn-info"><i
                                                        class="ico icon-plus m-r"></i>{{ $value['name'] }}
                                                标签图片添加</a>
                                        </header>
                                        <table class="table table-striped m-b-none">
                                            <thead>
                                            <tr>
                                                <th class="col-md-4">图片</th>
                                                <th class="col-md-3">作者</th>
                                                <th class="col-md-3">编辑时间</th>
                                                <th class="col-md-2">操作</th>
                                            </tr>
                                            </thead>
                                            <tbody>
                                            @if( !empty($value['data']) )
                                                @foreach($value['data'] as $banner)
                                                    <tr>
                                                        <td>
                                                            <a class="m-r"
                                                               href="{{ route('admin.banner.banner') }}?change=status&id={{ $banner->id }}">
                                                                @if( (bool)$banner->status )
                                                                    <i class="fa-tags fa text-xs text-ff552e text-center-xs"
                                                                       title="Banner图片开启"></i>
                                                                @else
                                                                    <i class="fa-tags fa text-xs text-no text-center-xs"
                                                                       title="Banner图片关闭"></i>
                                                                @endif
                                                            </a>
                                                            @if(!empty($banner->url))
                                                                <a target="_blank" href="{{ $banner->url }}"
                                                                   title="{{ $banner->tag }}">
                                                                    <img style="height:55px;"
                                                                         src="{{ $banner->image }}">
                                                                </a>
                                                            @else
                                                                <img style="height:55px;"
                                                                     src="{{ $banner->image }}">
                                                            @endif
                                                        </td>
                                                        <td>{{ $banner->author }}</td>
                                                        <td>{{ $banner->updated_at }}</td>
                                                        <td>
                                                            <a href="{{ route('admin.banner.banner_edit',$banner->id) }}"
                                                               class="btn btn-xs btn-default">编辑</a>
                                                            <a href="{{ route('admin.banner.banner') }}?del={{ $banner->id }}"
                                                               class="btn btn-xs btn-danger">删除</a>
                                                        </td>
                                                    </tr>
                                                @endforeach
                                            @else
                                                <tr>
                                                    <td colspan="3" align="center">暂无{{ $value['name'] }}相关信息,请<a
                                                                class="text-danger"
                                                                href="{{ route('admin.page.pageinfo_add') }}?label={{ $label }}">前往添加</a>!
                                                    </td>
                                                </tr>
                                            @endif
                                            </tbody>
                                        </table>
                                    </section>
                                </div>
                            </div>
                            <?php $j++; ?>
                        @endforeach
                    </div>
                </div>
            </section>
        @else
            <div class="alert alert-warning alert-block">
                <button type="button" class="close" data-dismiss="alert">×</button>
                <h4><i class="fa fa-bell-alt"></i>注意!</h4>
                <p>企业信息未添加模块,请<a class="text-danger" href="{{ route('admin.page.pagelabel_add') }}">前往添加</a>!</p>
            </div>
        @endif
    </div>
@endsection

@section('css')
@endsection

@section('js')
@endsection